import java.io.*;

public class IODemo11 {
    public static void main(String[] args) {
        try (OutputStream os = new FileOutputStream("D:/Test_IO/output.txt")) {
            try (OutputStreamWriter outputStreamWriter = new OutputStreamWriter(os,"utf-8")) {
                try (PrintWriter printWriter = new PrintWriter(outputStreamWriter)) {
                    printWriter.println("hello");
                    printWriter.print("你好\r\n");
                    printWriter.printf("1 + 1 = %d\r\n", 1 + 1);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
